package com.anyou.mall.platform.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.anyou.common.annotation.Log;
import com.anyou.common.core.controller.BaseController;
import com.anyou.common.core.domain.ApiResult;
import com.anyou.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.anyou.mall.platform.domain.OrdDelivery;
import com.anyou.mall.platform.service.IOrdDeliveryService;
import com.anyou.common.utils.poi.ExcelUtil;
import com.anyou.common.core.page.TableDataInfo;

/**
 * 配送设置Controller
 *
 * @author ruoyi
 * @date 2023-10-10
 */
@Api(tags = "配送金额设置")
@RestController
@RequestMapping("/platform/deliverySettings")
public class OrdDeliveryController extends BaseController
{
    @Autowired
    private IOrdDeliveryService ordDeliveryService;

    /**
     * 查询配送设置列表
     */
    /*@ApiOperation("查询配送设置列表")
    @PreAuthorize("@ss.hasPermi('platform:deliverySettings:list')")
    @GetMapping("/list")
    public TableDataInfo<List<OrdDelivery>> list(OrdDelivery ordDelivery)
    {
        startPage();
        List<OrdDelivery> list = ordDeliveryService.selectOrdDeliveryList(ordDelivery);
        return getDataTable(list);
    }*/

    /**
     * 导出配送设置列表
     */
    /*@ApiOperation("导出配送设置列表")
    @PreAuthorize("@ss.hasPermi('platform:deliverySettings:export')")
    @Log(title = "配送设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OrdDelivery ordDelivery)
    {
        List<OrdDelivery> list = ordDeliveryService.selectOrdDeliveryList(ordDelivery);
        ExcelUtil<OrdDelivery> util = new ExcelUtil<OrdDelivery>(OrdDelivery.class);
        util.exportExcel(response, list, "配送设置数据");
    }*/

    /**
     * 获取配送设置
     */
    @ApiOperation("获取配送设置")
    @PreAuthorize("@ss.hasPermi('platform:deliverySettings:query')")
    @GetMapping(value = "/getInfo")
    public ApiResult<OrdDelivery> getInfo()
    {
        return ApiResult.success(ordDeliveryService.selectOrdDeliveryByDeliveryId());
    }

    /**
     * 新增配送设置
     */
    /*@ApiOperation("新增配送设置")
    @PreAuthorize("@ss.hasPermi('platform:deliverySettings:add')")
    @Log(title = "配送设置", businessType = BusinessType.INSERT)
    @PostMapping
    public ApiResult add(@RequestBody OrdDelivery ordDelivery)
    {
        return ApiResult.success(ordDeliveryService.insertOrdDelivery(ordDelivery));
    }*/

    /**
     * 修改配送设置
     */
    @ApiOperation("新增or修改配送设置")
    @PreAuthorize("@ss.hasPermi('platform:deliverySettings:edit')")
    @Log(title = "配送设置", businessType = BusinessType.UPDATE)
    @PostMapping(value = "/addOrEdit")
    public ApiResult addOrEdit(@RequestBody OrdDelivery ordDelivery)
    {
        return ApiResult.success(ordDeliveryService.updateOrdDelivery(ordDelivery));
    }

    /**
     * 删除配送设置
     */
    /*@ApiOperation("删除配送设置")
    @PreAuthorize("@ss.hasPermi('platform:deliverySettings:remove')")
    @Log(title = "配送设置", businessType = BusinessType.DELETE)
    @DeleteMapping("/{deliveryIds}")
    public ApiResult remove(@PathVariable Long[] deliveryIds)
    {
        return ApiResult.success(ordDeliveryService.deleteOrdDeliveryByDeliveryIds(deliveryIds));
    }*/
}
